package com.fuss.activitytest

import android.app.Activity
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_four.*

class FourActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_four)

        val uriString = intent.getStringExtra("extra_data")

        open_biying_btn.setOnClickListener {

            val intent = Intent(Intent.ACTION_VIEW)
            intent.data = Uri.parse(uriString)
            startActivity(intent)
        }

        finish_btn.setOnClickListener {

            val intent = Intent()
            intent.putExtra("data_return_message", "This message is from FourActivity")
            setResult(Activity.RESULT_OK, intent)
            finish()
        }
    }
}
